<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>文件详情</title>
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
            background: linear-gradient(135deg, #0f1629 0%, #1a1f35 100%);
            height: 100%;
            width: 100%;
        }

        .content {
            width: 100%;
            height: 100%;
            overflow: auto;
            color: #34d399;
            background: rgba(26, 30, 48, 0.95);
            backdrop-filter: blur(10px);
            padding: 4%;
            box-sizing: border-box;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
            /* 添加弹性滚动 */
            -webkit-overflow-scrolling: touch;
        }

        #content-detail {
            width: 100%;
            height: 100%;
            overflow: auto;
            /* 保持原始格式，不换行 */
            white-space: pre;
            line-height: 1.5;
            font-size: 0.875rem;
        }
    </style>
</head>
<body>
<div class="content">
    <div id="content-detail"></div>
</div>
<script>
    const params = getQueryParams();
    fetch(params.url)
    .then(response => response.text())
    .then(data => {
        // 使用 textContent 而不是 innerHTML，让 CSS 处理换行
        document.getElementById("content-detail").textContent = data;
    })
    .catch(error => {
    });

    function getQueryParams() {
        const url = window.location.href;
        const regExp = /[?&]([^=#]+)=([^&#]*)/g;
        let params = {};
        let match;
        while (match = regExp.exec(url)) {
            params[match[1]] = decodeURIComponent(match[2]);
        }
        return params;
    }
</script>
</body>
</html>
